﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bullet : MonoBehaviour
{

    public float speed;
 

    void Update ()
    {
        transform.Translate(Vector3.up * speed * Time.deltaTime);
    }
 

    private void OnTriggerEnter2D(Collider2D collision)
    {
        switch (collision.gameObject.tag)
        {
            case "enemy":
                collision.gameObject.GetComponent<enemymanager>().damaged();
                Destroy(gameObject);
                break;
            case "wall":
                Destroy(collision.gameObject);
                Destroy(gameObject);
                break;
            case "barrier":
                Destroy(gameObject);
                break;
            case "heart":
                collision.gameObject.GetComponent<heartmanager>().damaged();
                Destroy(gameObject);
                break;

        }
    }
}
